package camel.file;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

//import org.springframework.context.ApplicationContext;
//import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args ) throws InterruptedException
    {
        ApplicationContext ac = new ClassPathXmlApplicationContext("application.xml");
        
       /* new Thread(new Runnable() {
			@Override
			public void run() {
				try {
					//写文件时间长，模拟从另一个地方同步过来，大文件同步到目标文件夹中，如果文件比较大，这时，定时任务开始同步，那么就会锁定文件，知道该文件移动完，才会同步走
					String content = "a dog will be write in file";
					File file = new File("D:\\tmp\\ff.done");
					if(!file.exists()){
						file.createNewFile();
					}
					FileWriter fileWriter = new FileWriter(file.getAbsoluteFile());
					BufferedWriter bw = new BufferedWriter(fileWriter);
					content=content+"   -----     ";
					bw.write(content+"\n");
					Thread.sleep(2000);
					bw.flush();
					bw.close();
					System.out.println("finish");
			    } catch (IOException e) {
			        e.printStackTrace();
			    } catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
		    }
		}).start();
        while (true) {
            Thread.sleep(10000);
        }*/
    
    
    }

}
